﻿package net.wangit.user;

import net.wangit.Element;
import net.wangit.framework.action.ActionMapping;
import net.wangit.view.element.ElementComponent;
import net.wangit.view.unit.UnitComponent;

public class SuperUser extends LimitedSuperUser {

	private static final long serialVersionUID = 1L;

	protected SuperUser(String id) {
		super(id);
	}

	public boolean hasUnitPrivilege(String domain, String unitId,
			String unitShowMode) {
		return !"dev".equals(domain);
	}

	public boolean hasActionPrivilege(ActionMapping am) {
		return !"dev".equals(am.getDomain());
	}

	public boolean hasElementPrivilege(Element element) {
		UnitComponent uc = ((ElementComponent) element).getParent();
		if (uc == null)
			return true;
		else
			return !"dev".equals(uc.getDomain());
	}

	public boolean hasDataPrivilege(Object key) {
		return true;
	}
}
